package org.hxyjs.dao.impl;

import org.hxyjs.dao.AnswerrecordDao;
import org.hxyjs.entity.Answerrecord;
import org.hxyjs.mapper.AnswerrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("answerrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class AnswerrecordDaoImpl implements AnswerrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private AnswerrecordMapper answerrecordMapper;
    public List<Answerrecord>  getAllAnswerrecords() throws Exception{
        return answerrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteAnswerrecordByAnrno(String anrno)  throws Exception{
        return answerrecordMapper.deleteByPrimaryKey(anrno);
    }

    @Override
    public Integer updateAnswerrecordByAnrno(Answerrecord answerrecord)  throws Exception{
        return answerrecordMapper.updateByPrimaryKey(answerrecord);
    }

    @Override
    public Integer addAnswerrecord(Answerrecord answerrecord)  throws Exception{
        return answerrecordMapper.insertSelective(answerrecord);
    }

}
